package test

import android.content.Context
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import android.util.Log
import androidx.appcompat.widget.AppCompatImageView

/**
 * OverloadImageView
 *
 * @author a_liYa
 * @date 2021/11/7 19:22.
 *
 */
class OverloadImageView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet?,
    defStyleAttr: Int = 0
) : AppCompatImageView(context, attrs, defStyleAttr) {

    override fun setImageDrawable(drawable: Drawable?) {
        drawable?.run {
            if (this is BitmapDrawable) {
                Log.e("OverloadImageView", "setImageDrawable: Drawable: $drawable; Bitmap: ${this.bitmap} ")
            }
        }
        super.setImageDrawable(drawable)
    }
}